#!/usr/bin/env node

const http = require('http'),
      html = `<!DOCTYPE html>
      <html lang="en">
      <head>
        <meta charset="UTF-8">
        <title>login</title>
      </head>
      <body>
        <form action="">
        <label>用户名:</label>
        <input type="text" name="username:">
        <br>
        <label>密码:</label>
        <input type="password" name="password">
        <br>
        <input type="button" value="登录">
        <br>
        </form>
    </body>
    </html>`;

http.createServer((req,res)=>{
  //status code
  //header.txt/html
  if(req.url !== '/'){
    res.statusCode = 404;
    res.setHeader('Content-Type','text/html');
    res.end('<h1>not found</h1>');
    return;
  }
    req.pipe(process.stdout);
    res.end('ok');
}).listen(8080);
